/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "pasajero")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pasajero.findAll", query = "SELECT p FROM Pasajero p"),
    @NamedQuery(name = "Pasajero.findByCuit", query = "SELECT p FROM Pasajero p WHERE p.cuit = :cuit"),
    @NamedQuery(name = "Pasajero.findByApellido", query = "SELECT p FROM Pasajero p WHERE p.apellido = :apellido"),
    @NamedQuery(name = "Pasajero.findByNombre", query = "SELECT p FROM Pasajero p WHERE p.nombre = :nombre"),
    @NamedQuery(name = "Pasajero.findByDomicilio", query = "SELECT p FROM Pasajero p WHERE p.domicilio = :domicilio"),
    @NamedQuery(name = "Pasajero.findByTelefono", query = "SELECT p FROM Pasajero p WHERE p.telefono = :telefono"),
    @NamedQuery(name = "Pasajero.findByFnac", query = "SELECT p FROM Pasajero p WHERE p.fnac = :fnac")})
public class Pasajero implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "cuit")
    private Integer cuit;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "apellido")
    private String apellido;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "nombre")
    private String nombre;
    @Size(max = 45)
    @Column(name = "domicilio")
    private String domicilio;
    @Column(name = "telefono")
    private Integer telefono;
    @Column(name = "fnac")
    @Temporal(TemporalType.DATE)
    private Date fnac;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cuit")
    private Collection<Tarjeta> tarjetaCollection;

    public Pasajero() {
    }

    public Pasajero(Integer cuit) {
        this.cuit = cuit;
    }

    public Pasajero(Integer cuit, String apellido, String nombre) {
        this.cuit = cuit;
        this.apellido = apellido;
        this.nombre = nombre;
    }

    public Integer getCuit() {
        return cuit;
    }

    public void setCuit(Integer cuit) {
        this.cuit = cuit;
    }

    public String getApellido() {
        return apellido;
    }

    public void setApellido(String apellido) {
        this.apellido = apellido;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDomicilio() {
        return domicilio;
    }

    public void setDomicilio(String domicilio) {
        this.domicilio = domicilio;
    }

    public Integer getTelefono() {
        return telefono;
    }

    public void setTelefono(Integer telefono) {
        this.telefono = telefono;
    }

    public Date getFnac() {
        return fnac;
    }

    public void setFnac(Date fnac) {
        this.fnac = fnac;
    }

    @XmlTransient
    public Collection<Tarjeta> getTarjetaCollection() {
        return tarjetaCollection;
    }

    public void setTarjetaCollection(Collection<Tarjeta> tarjetaCollection) {
        this.tarjetaCollection = tarjetaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cuit != null ? cuit.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pasajero)) {
            return false;
        }
        Pasajero other = (Pasajero) object;
        if ((this.cuit == null && other.cuit != null) || (this.cuit != null && !this.cuit.equals(other.cuit))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Pasajero[ cuit=" + cuit + " ]";
    }
    
}
